public class P13 {
    public static void main(String[] args) {
        int num = 1234;

        int qian = num/1000;
        int bai = num%1000/100;
        int shi = num%1000%100/10;
        int ge = num%1000%100%10/1;

        int sum = qian+bai+shi+ge;
        System.out.println(sum);
    }
}
